import MessageModel from '@/models/message';
import NewsIndexModel from '@/models/newsIndex';
import IndexModel from '@/models/newsIndex';
import SignUpModel from '@/models/signUp';
import messageService from '@/services/MessageService';
import SingUpService from '@/services/signUpService';
import { action, computed, observable } from 'mobx';
import { message } from 'antd';

export default class SingUpStore {
    @observable
    messageSave?: SignUpModel;
    @observable
    messageInfoLoading: boolean = false;

    @observable
    username?: string;
    @observable
    email?: string;
    @observable
    pnone?: string;
    @observable
    content?: string;
    @observable
    workName?: string;
    @observable
    cover?: string;
    @observable
    tag?: number;
    @observable
    gameType?: number;
    @observable
    gameTypeName?: string;
    @observable
    tagName?: string;
    @observable
    e?: any;

    // 
    @action
    async saveSignUp() {
        let option = {
            username: this.username,
            phone: this.pnone,
            email: this.email,
            workName: this.workName,
            content: this.content,
            cover: this.cover,
            tag: this.tag,
            gameType: this.gameType,

        }
        const result = await SingUpService.save(option);
        if (result.isSuccess) {
            message.success("添加成功")

        }
    }
    @action
    async filePost() {
        const result = await SingUpService.postFile(this.e);

    }

}

export const signUpStore = new SingUpStore();
